﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<brjostagjof.Models.MySiteContainer>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Síðan Mín
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

  
  <ul>
  <% if (Page.User.IsInRole("Administrators"))
     { %>
        <li class="noStyle"><b style="font-size: x-large;">Tæki fyrir stjórnendur</b></li>
        <li class="mySiteList"> <a href="/MySite/AddSurvey/" class="mySiteAction">Búa til nýja könnun</a> </li>
        <li class="mySiteList"> <a href="/Account/RegisterSpecialist/" class="mySiteAction">Bæta við fagaðila</a></li>
        <% }
            if (Page.User.IsInRole("Specialists") || Page.User.IsInRole("Administrators"))
           { %>
            <li class="mySiteList"><a href="/Home/GetUnansweredQuestions" class="mySiteAction">Ósvaraðar spurningar</a></li>
        <% }
         if (Page.User.IsInRole("Administrators"))
         { %>
        <li class="noStyle2"></li>
  <% } %>
    <li class="noStyle"><b style="font-size: x-large;">Mitt svæði</b></li>
    <% if (Page.User.IsInRole("PublicUser"))
       { %>
  <li class="mySiteList"><a id="born" class="mySiteAction">Börnin mín</a>
  <table id="listOfChilds">
  <tbody>
 
  <%foreach (var item in Model.child)
    { %>
    <tr>
        <td><img class="thumbnail"src="/../../images/<%:item.profilePictureUrl%> " alt="schoolbook" /> <ul><li><a href="/MySite/EditChild/<%: item.ID %>" class="children"> <%: item.name%></a></li><li> Aldur: <%:item.age%> mánuðir </li> <li><%: item.description%></li><li><a href="/Mysite/EditChild/<%: item.ID %>"> &raquo;&nbsp;Breyta</a></li><li class="smaNidur"><a style=" cursor:pointer;"  id="timalina<%:item.ID %>" >&raquo;&nbsp;Tímalína barns</a></li></ul> </td>
    </tr>
    <tr id="synaTimaLinu<%:item.ID %>" style="display:none">
    <td><div style="left:10px; position:relative; top:5px; margin-bottom: 250px;">
   
    <div style="left:10px; position:relative; top:-20px;"><ul><li style="display:inline">&raquo;&nbsp;Eldri Færslur &nbsp;&nbsp;&nbsp;&nbsp;</li><li style="display:inline">&raquo;&nbsp;Nýrri Færslur &nbsp;&nbsp;&nbsp;&nbsp;</li><li style="display:inline"><a href="/MySite/AddTimeline/<%: item.ID%>">&raquo;&nbsp;Bæta inn nýrri færslu</a> </li></ul></div>
    <div style="left:10px; position:relative; top:-20px;">
    
    <ul>
     <%foreach (var entry in Model.myTimelines)
       {%>

       <%if(entry.childID==item.ID)  {%>
      
        <li><a id="syna<%:entry.ID %>" style=" cursor:pointer;"><%:entry.date.ToString("dd. MMMM HH:mm")%></a></li>
          
        <% }%>
    <%} %>
    </ul>

     <%foreach (var entry in Model.myTimelines)
       {%>

       <%if(entry.childID==item.ID)  {%>
      
       
        <div id="syna2<%:entry.ID%>" style="left:150px; position:absolute; display:none; top:10px; width:400px ">
       <p>
       
       <% if (entry.pictureID != null)
          {%>
       <img  style="width:170px; float:left; margin-right:5px " src="/../../images/<%:entry.Picture.url %>" alt="schoolbook" />
       <%} %>

        <% if (entry.description != null){%>
            <%:entry.description %>

            <script type="text/javascript">

                $(("#syna") + <%:entry.ID %>).hover(function () {
                    $(("#syna2") + <%:entry.ID%>).show();
                }, function () {
                    $(("#syna2")+ <%:entry.ID%>).hide();
                });
            
            </script>

        <%} %>
            </p>
            
     </div>
        
        
        <% }%>
    <%} %>
     
    
    </div>
         <script type="text/javascript">
             $(("#timalina") + <%:item.ID %>).click(function () {
                 $(("#synaTimaLinu") + <%:item.ID %> ).toggle("slow");
             });

             
          </script>
    </div>
    </td>
    </tr>    
       
  <%} %>
  </tbody>
  </table>   </li>
  <li class="mySiteList"><a class="mySiteAction"  id="nyttBarn">Bæta við barni</a> 
  <ul>
  <li id="formNyttBarn">
  <% using (Html.BeginForm("Addchild", "MySite", FormMethod.Post, new { enctype = "multipart/form-data" }))
     {%>
        <%: Html.ValidationSummary(true)%>
        
        <fieldset>
            <div class="editor-label">
                Nafn barns:
            </div>
             <div class="editor-field">
                <%: Html.TextBoxFor(model => model.newchild.name)%>
                <%: Html.ValidationMessageFor(model => model.newchild.name)%>
            </div>
            <div class="editor-label">
                Slóð fyrir mynd:
            </div>
            <div class="editor-field">
                <input type="file" name="files" id="file2" size="25"  />  
            </div>

            <div class="editor-label">
                Aldur í mánuðum:
            </div>

             <div class="editor-field">
                <%: Html.TextBoxFor(model => model.newchild.age)%>
                <%: Html.ValidationMessageFor(model => model.newchild.age)%>
            </div>

             <div class="editor-label">
                Um barnið:
            </div>
             <div class="editor-field">
                <%: Html.TextAreaFor(model => model.newchild.description, new { rows = "10", cols = "40" })%>
                <%: Html.ValidationMessageFor(model => model.newchild.description)%>
            </div>

            <p>
                <input type="submit" value="Skrá barn" />
            </p>

         </fieldset>

    <% } %>
  
  
  </li>
  </ul>
  </li>
  <% } %>
  <li class="mySiteList"><a id="greinar" class="mySiteAction">Mitt greinasafn</a>
      <div id="minarGreinar">
            <%foreach (var item in Model.myArticles)
              { %>
              <div id="<%:item.InformationBase.ID %>">
                  <div class="theBox">
                    <p class="titleSmall"><a href="<%: item.InformationBase.ArticleBase.link %><%: item.InformationBase.ID %>"><%: item.InformationBase.headline%></a></p>
                    <span class="underForSmallTitle">Höfundur greinar: <%: item.User.name%>, <%: item.InformationBase.date%> &nbsp;&bull;&nbsp; 
                    <a href="/Home/GetArticleByCategoryID/<%: item.ArticleCategory.ID %>" class="permalink"> <%: item.ArticleCategory.name%></a> 
                    &nbsp;&bull;&nbsp; 
                    <a href="<%: item.InformationBase.ArticleBase.link %><%: item.InformationBase.ID %>" class="permalink">Öll grein</a> &nbsp;&bull;&nbsp; 
                     <a onclick="deleteGrein(<%= item.InformationBase.ID %>, <%= Model.theUser.ID %> );">Taka úr safni</a> </span>                
                    </div>
                </div>
                <%} %>
       </div>
  </li>
  <li id="vinir2" class="mySiteList"><a id="vinir" class="mySiteAction">Mínir Vinir</a>
  <div id="vinaListi">
  
  <% foreach (var item in Model.contacts)
     {%>
     <div class="theBox2" id="notandi<%: item.ID %>">
        <p class="titleSmall2"><a class="headline" href="../../MySite/ViewUserByID/<%: item.ID %>"><%: item.name %></a> &nbsp;&bull;&nbsp;<a href="../../MySite/ViewUserByID/<%: item.ID %>">Skoða Betur</a>&nbsp;&bull;&nbsp;<a href="#"  onclick="DeleteUserContact( <%= Model.theUser.ID %>,<%= item.ID %> );">Eyða</a></p>
     </div>
  <%} %>

  </div>
  </li>

  <li class="mySiteList"><a  id="synaMinarUpp" class="mySiteAction">Mínar Upplýsingar</a><div>
  <table id="minarUpp" style="margin-bottom:600px;">
  <tbody>
  <tr>
     <td><img class="thumbnail2"src="/../../images/<%= Model.pic.url %>" alt="schoolbook" /><ul>
     <%if (Model.theUser.name != null)
       { %>
        <li><b>Nafn:</b>&nbsp;<%:Model.theUser.name  %></li>
     <%} %>
     <%if (Model.theUser.email != null)
       { %>
        <li><b>Netfang:</b>&nbsp;<%:Model.theUser.email  %></li>
     <%} %>
     <%if (Model.theUser.age != null)
       { %>
        <li><b>Aldur:</b>&nbsp;<%: Model.theUser.age %></li>
     <%} %>
     <%if (Model.theUser.gender != null && Model.theUser.gender== true)
       { %>
        <li><b>Kyn:</b> Karlkyns</li>
        <%} %>
     <%if (Model.theUser.gender != null && Model.theUser.gender== false)
       { %>
             <li><b>Kyn:</b> Kvenkyns</li>
     <%} %>
     <%if (Model.theUser.address != null)
       { %>
            <li><b>Heimilsfang:</b>&nbsp;<%: Model.theUser.address  %></li>
     <%} %>
     <%if (Model.theUser.zipCode != null)
       { %>
            <li><b>Póstnúmer:</b>&nbsp;<%:Model.theUser.zipCode  %></li>
     <%} %>
        <%if (Model.theUser.description != null)
       { %>
            <li><b>Um mig:</b></li>
            <li style="width:500px;"><%:Model.theUser.description%></li>
           
     <%} %>
             <li class="adeinsNidur"><a href="/Mysite/EditMyProfile/<%=Model.theUser.ID %>"> &raquo;&nbsp;Breyta upplýsingum</a></li>
             <li><a href="/Account/ChangePassword">&raquo;&nbsp;Breyta lykilorði</a></li>
     </ul></td>
    </tr> 
  </tbody>
  </table>
  </div>
  </li>
  </ul>
  <div style="display:none;">
  <h2>Files uploaded to server</h2>    

<% using (Html.BeginForm("Upload", "MySite", FormMethod.Post, new { enctype = "multipart/form-data" }))
{%><br />
    <input type="file" name="files" id="file1" size="25" />

    <input type="submit" value="Bæta við mynd" />      
<% } %>
</div>

</asp:Content>
